#set($title = "智能会议预定系统-我的预约")
#includeFootable
<div class="row">
    <div class="span12">
        <table class="footable table" data-filter="#filter" data-page-size="10" data-page-previous-text="上一页" data-page-next-text="下一页" data-page-navigation=".pagination">
            <thead>
                <tr>
                <th data-toggle="true">
                    会议室
                </th>
                <th data-sort-initial="true">
                    开始时间
                </th>
                <th data-hide="phone">
                    结束时间
                </th>
                <th>
                    会议标题
                </th>
                <th data-hide="all">
                    会议描述
                </th>
                 <th >
                    会议状态
                </th>
                <th>
                    操作
                </th>
            </thead>
            <tbody>
                #foreach($book in $myBooks)
                <tr>
                    <td>
                        $meetingTool.getMeetingName($book.getMeetingId())
                    </td>
                    <td>
                        $date.format("yyyy-MM-dd HH:mm:ss",$book.getBookStartTime())
                    </td>
                    <td>
                        $date.format("yyyy-MM-dd HH:mm:ss",$book.getBookEndTime())
                    </td>
                    <td>
                        $!book.getMeetingTitle()
                    </td>
                    <td>
                        $!book.getMeetingDescription()
                    </td>
                    <td>
                        #if($!book.state==0)尚未被执行#elseif($!book.state==1)执行中#else已执行#end
                    </td>
                    <td>
                        <button class="ui-button-primary ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button"href="/books/modify/my/$book.id">
                            修改
                        </button>
                        <button class="ui-button-error ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" href="/books/delete/my/$book.id">
                            删除
                        </button>
                        #if($!book.state==0)
                        <button class="ui-button-success ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" href="/books/excute/my/$book.id">
                           开始执行
                        </button>
                        #elseif($!book.state==1)
                        <button class="ui-button-success ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" href="/books/excuted/my/$book.id">
                           执行完毕
                        </button>
                        #end
                    </td>
                </tr>
                #end
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="7">
                        <div class="pagination pagination-centered">
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </div>
    #if($myBooks.size()==0)
    <div class="span12">
        <div class="ui-widget">
            <div class="ui-state-highlight ui-corner-all">
                <p>
                    <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                    您<strong>尚未</strong>
                    预定过会议室！
                </p>
            </div>
        </div>
    </div>
    #end
</div>
<script type="text/javascript">
    $(function(){
        $('.footable').footable();
        $('.clear-filter').click(function(e){
            e.preventDefault();
            $('table.demo').trigger('footable_clear_filter');
            $("select[class^='filter-']").each(function(){
                $(this).val('全部');
            });
            $("#filter").val("");
        });
        $("select[class^='filter-']").change(function(e){
            e.preventDefault();
            var filter = $(this).val();
            $('#filter').val($(this).text());
            $('table.footable').trigger('footable_filter', {
                filter: filter
            });
        });
        $("tfoot tr td").show();
		$("button[href].ui-button-primary").click(function(){
			window.location.href=$(this).attr("href");
		});
        $("button[href].ui-button-error").click(function(){
            var result = confirm("确认是否删除？");
            if (result) {
                var btn = $(this);
                jQuery.get($(this).attr("href"), {}, function(data){
                    if (data == true) {
                         btn.parent("td").parent("tr").remove();
                         $('.footable').trigger('footable_initialize');
                         alert("删除成功！");
                    }
                    else {
                        alert("删除失败！");
                    }
                });
                
            }
        });
        $(".ui-button-success").click(function(){
        	jQuery.get($(this).attr("href"),{},function(data){
        		if(data==true){
        			alert("操作成功!");
        			window.location.href=window.location.href;
        		}else{
        			alert("操作失败!请检查当前时间是否在预定时间15分钟以内!");
        		}
        	});
        });
    });
</script>
